<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{$lang.home}{if $ur_here} - {$ur_here} {/if}</title>
<meta name="Copyright" content="Douco Design." />
<link href="templates/public.css" rel="stylesheet" type="text/css">
{include file="javascript.htm"}
</head>
<body>
<div id="dcWrap">
 {include file="header.htm"}
 <div id="dcLeft">{include file="menu.htm"}</div>
 <div id="dcMain">
   {include file="ur_here.htm"}
   <div id="manager" class="mainBox" style="{$workspace.height}">
    <h3><!-- {if $rec neq 'manager_log'} 列表 --><a href="{$action_link.href}" class="actionBtn add">{$action_link.text}</a><!-- {/if} -->{$ur_here}</h3>
    <!-- {if $rec eq 'default'} 列表 -->
    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
     <tr>
      <th width="30" align="center">{$lang.record_id}</th>
      <th align="left">{$lang.role_name}</th>
      <th align="center">{$lang.add_time}</th>
      <th align="center">{$lang.handler}</th>
     </tr>
     <!-- {foreach from=$role_list item=row} -->
     <tr>
      <td align="center">{$row.id}</td>
      <td>{$row.name}</td>
      <td align="center">{$row.add_time}</td>
      <td align="center"><a href="manager_role.php?rec=edit&id={$row.id}">{$lang.edit}</a> | <a href="manager_role.php?rec=del&id={$row.id}">{$lang.del}</a></td>
     </tr>
     <!-- {/foreach} -->
    </table>
    <!-- {/if} -->

    <!-- {if $rec eq 'edit' || $rec eq 'add'} 编辑 -->
    <form action="manager_role.php?rec={if $rec eq 'edit'}update{else}insert{/if}" method="post">
     <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
      <tr>
       <td width="100" align="right">{$lang.role_name}</td>
       <td>
        <input type="text" name="name" value="{$manager_info.name}" size="40" class="inpMain"/>
       </td>
      </tr>
      <tr>
       <td width="100" align="right">权限分配</td>
       <td>

        <!--权限列表-->
        <table>
          {foreach from=$admin_privs item=row}
          <tr>
           <td width="150" align="right"><label id="label" for="{$row.mod}"><input {if $action_list == 'ALL' || in_array($row.mod, $action_list)}checked=checked{/if} level='parent' mod='{$row.mod}' type="checkbox" name='action_list[]' id="{$row.mod}" class="parent_{$row.mod}" value="{$row.mod}">{$row.name}(菜单)</label> &nbsp;&nbsp;</td>
           {foreach from=$row.priv item=v key=k}
           <td width="100">
            &nbsp;&nbsp;<label for="{$k}"><input {if isset($priv_list)}{if $priv_list == 'ALL' || in_array($k, $priv_list)}checked=checked{/if}{/if} level='son' id="{$k}" type="checkbox" name="priv_list[]" mod='{$row.mod}' class="inpMain son_{$row.mod}" value="{$k}">{$v}</label>
           </td>
           {/foreach}
          </tr>
          {/foreach}
        </table>
        <script>
          {literal}
          $(function(){
              $('[level=parent]').click(function(){
                  if(this.checked)
                      $('.son_'+$(this).attr('mod')).prop('checked','checked');
                  else
                      $('.son_'+$(this).attr('mod')).removeAttr('checked');
              });
              $('[level=son]').click(function(){
                  if(this.checked){
                      $('.parent_'+$(this).attr('mod')).prop('checked','checked');
                  }else{
                      $(this).parent("li").find('input').removeAttr('checked');
                  }
              });
          });
          {/literal}
        </script>

       </td>
      </tr>

      
      <tr>
       <td></td>
       <td>
        <input type="hidden" name="token" value="{$token}" />
        <input type="hidden" name="id" value="{$manager_info.id}" />
        <input type="submit" name="submit" class="btn" value="{$lang.btn_submit}" />
       </td>
      </tr>
     </table>
    </form>
    <!-- {/if} -->

   </div>
 </div>
 {include file="footer.htm"}
 </div>
</body>
</html>